package xmlimporter;

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;

import org.junit.Test;

public class XmlImporterTest {

	XmlImporter xmlImp = new XmlImporter();
	String prefix = "src\\xmlimporter\\";

	@Test
	public void fileExistTest() {
		assertTrue(createFile("target.xml").isFile());
		assertTrue(createFile("targetEmpty.xml").isFile());
	}

	@Test
	public void EntryListIsEmpty() throws IOException {
		xmlImp.importEntries(createFile("targetEmpty.xml"));
		assertEquals(xmlImp.isEntryListEmpty(), true);
	}

	@Test
	public void EntryListIsNotEmpty() throws IOException {
		xmlImp.importEntries(createFile("target.xml"));
		assertEquals(xmlImp.isEntryListEmpty(), false);
	}

	private File createFile(String name) {
		return new File(prefix + name);
	}

}
